package com.zis.auth.controller;

import com.zis.auth.model.Login;
import com.zis.auth.model.ResetPwd;
import com.zis.auth.service.ILoginInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Create by wangshen 2017/12/21
 */
@RestController
@RequestMapping("/api/sys/login")
public class LoginController {

    @Autowired
    private ILoginInter loginInter;

    /**
     * 用户登录
     * @param login
     * @return
     */
    @RequestMapping(value = "/user", method = RequestMethod.POST)
    @ResponseBody
    public String login(@RequestBody Login login) throws Exception {
        return loginInter.login(login);
    }

    /**
     * 密码重置
     * @param resetPwd
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/reset/code", method = RequestMethod.POST)
    @ResponseBody
    public String resetPassword(@RequestBody ResetPwd resetPwd) throws Exception {
        return loginInter.resetPassword(resetPwd);
    }
}
